#define _CRT_SECURE_NO_WARNINGS
#include<string>
#include<iostream>
using namespace std;
bool isPalindrome(string s) {
    string s1;
    for (auto ch : s)
    {
        if (isalpha(ch) && islower(ch))
        {
            s1.push_back(ch);
        }
        else
        {
            tolower(ch);
            s1.push_back(ch);
        }
    }
    if (s1.empty())
    {
        return false;
    }
    int begin = 0, end = s1.size() - 1;
    while (begin <= end)
    {
        if (s1[begin++] != s1[end--])
        {
            return false;
        }
    }
    return true;
}
bool isPalindrome1(string s) {
    string s1;
    for (auto ch : s)
    {
        if (islower(ch))
        {
            s1.push_back(ch);
        }
        else
        {
            tolower(ch);
            if(islower(ch))
            s1.push_back(ch);
        }
    }
    cout << s1 << endl;
    if (s1.empty())
    {
        return false;
    }
    int begin = 0, end = s1.size() - 1;
    while (begin <= end)
    {
        
        if (s1[begin++] != s1[end--])
        {
            return false;
        }
    }
    return true;
}
int main()
{
    string s = "A man, a plan, a canal: Panama";
    isPalindrome1(s);
    return 0;
}
class Solution {
public:
    bool isPalindrome(string s) {
        string s1;
        for (auto ch : s)
        {
            if (isalnum(ch))
            {
                s1 += tolower(ch);
            }
        }
        int begin = 0;
        int end = s1.size() - 1;
        while (begin <= end)
        {
            if (s1[begin++] != s1[end--])
            {
                return false;
            }
        }
        return true;
    }
};
class Solution {
public:
    bool isPalindrome(string s) {
        string s1;
        for (auto ch : s)
        {
            if (isalnum(ch))
            {
                s1 += tolower(ch);
            }
        }
        string s2(s1);
        reverse(s1.begin(), s1.end());
        return s1 == s2;
    }
};